package ren.steve.system.custom;

import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import ren.steve.common.utils.MD5;

/**
 * 自定义密码组件
 */
@Component
public class CustomMd5Password implements PasswordEncoder {
  @Override
  public String encode(CharSequence charSequence) {
    return MD5.encrypt(charSequence.toString());
  }

  @Override
  public boolean matches(CharSequence charSequence, String s) {
    return s.equals(MD5.encrypt(charSequence.toString()));
  }
}
